home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / RINDEX.C < prev    next >
C/C++ Source or Header  |  1984-07-29  |  409b  |  22 lines

  1. /*    rindex.c - find last occurrence of character in string.
  2.     (C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
  3.     G. R. Mansfield.  84/06/06.
  4.     Ver 1.0-4729.
  5. */
  6.  
  7. #include <defstd.h>
  8.  
  9. char *rindex(s, c)    /* return pointer to last occurrence of c in s */
  10. char *s, c;    /* NULL if c is not in s */
  11. {
  12.     char *p;
  13.  
  14.     p = NULL;
  15.     while (*s) {
  16.         if (*s == c)
  17.             p = s;
  18.         s++;
  19.     }
  20.     return(p);
  21. }
  22.